package com.wx.wxapp.controller;

import com.wx.wxapp.entity.Address;
import com.wx.wxapp.service.AddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

@RestController
public class AddressController {
    @Autowired
    private AddressService addressService;


    @RequestMapping(value = "/saveCoordinate",method = RequestMethod.POST)
    public void SaveCoordinate(@RequestParam("latitude")BigDecimal latitude, @RequestParam("longitude")BigDecimal longitude,
                               @RequestParam("status")String status){
        addressService.SaveCoordinate(latitude,longitude,status);
    }

    @RequestMapping(value = "/saveaa",method = RequestMethod.GET)
    public List<Map> SaveCoordinate(@RequestParam("latitude")BigDecimal latitude, @RequestParam("longitude")BigDecimal longitude){
        return addressService.GetCurrentPet(latitude,longitude);
    }

}
